package com.clas.liu.myapplication.view.activity.impl;

import android.os.Bundle;
import android.support.annotation.Nullable;

import com.clas.liu.myapplication.R;
import com.clas.liu.myapplication.presenter.impl.BasePresenter;
import com.clas.liu.myapplication.view.fragment.impl.PersonChatFragment;
import com.clas.liu.myapplication.view.util.SaveUtil;
import com.hyphenate.easeui.EaseConstant;

/**
 * Created by liu on 2019/5/8.
 */

public class ChatActivity extends BaseActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_chat_layout);
        //new出EaseChatFragment或其子类的实例
        if (getIntent().getStringExtra("name")!=null && !getIntent().getStringExtra("name").equals(""))
            SaveUtil.saveChatUser(this, getIntent().getStringExtra(EaseConstant.EXTRA_USER_ID),
                    getIntent().getStringExtra("name"), getIntent().getStringExtra("head"));
        PersonChatFragment chatFragment = new PersonChatFragment();
        //传入参数
        Bundle args = new Bundle();
        args.putInt(EaseConstant.EXTRA_CHAT_TYPE, EaseConstant.CHATTYPE_SINGLE);
        args.putString(EaseConstant.EXTRA_USER_ID, getIntent().getStringExtra(EaseConstant.EXTRA_USER_ID));
        args.putString("name", getIntent().getStringExtra("name"));
        chatFragment.setArguments(args);
        getSupportFragmentManager().beginTransaction().add(R.id.fl_chat_content, chatFragment).commit();
    }

    @Override
    protected BasePresenter getPresenter() {
        return null;
    }
}
